package com.huadao.cart_ccs.data.task;

import com.huadao.cart_ccs.data.bo.ChangeLiquidAmount;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 置换
 */
public class ChangeLiquidBO implements Serializable {
    private static final long serialVersionUID = -5173878128104139095L;
    private List<ChangeLiquidTurn> changeLiquidTurnList;

    public ChangeLiquidBO() {
        changeLiquidTurnList=new ArrayList<>();
    }

    public ChangeLiquidBO(List<ChangeLiquidTurn> changeLiquidTurnList) {
        this.changeLiquidTurnList = changeLiquidTurnList;
    }

    public List<ChangeLiquidTurn> getChangeLiquidTurnList() {
        return changeLiquidTurnList;
    }

    public void setChangeLiquidTurnList(List<ChangeLiquidTurn> changeLiquidTurnList) {
        this.changeLiquidTurnList = changeLiquidTurnList;
    }

    public void addTurn(ChangeLiquidTurn changeLiquidTurn){
        changeLiquidTurnList.add(changeLiquidTurn);
    }

//    public int getAmountByTurnIndex(int turn,int index){
//        return changeLiquidTurnList.get(turn-1).getAmountList().get(index-1);
//    }

    public int getFluidAmountByTurnIndex(int turn,int index){
        return changeLiquidTurnList.get(turn-1).getAmountList().get(index-1).getFluid();
    }

    public int getWasteAmountByTurnIndex(int turn,int index){
        return changeLiquidTurnList.get(turn-1).getAmountList().get(index-1).getWaste();
    }

    public int getIntervalTimeByTurn(int turn){
        return changeLiquidTurnList.get(turn-1).getIntervalTime();
    }

    public int getFluidTypeTurnIndex(int turn,int index) {
        return changeLiquidTurnList.get(turn-1).getAmountList().get(index-1).getFluidType();
    }

    /**
     * 置换每轮
     */
    public class ChangeLiquidTurn{
        private List<ChangeLiquidAmount> amountList;
        //于下一轮的间隔时间
        private int intervalTime;//秒

        public ChangeLiquidTurn() {
            amountList=new ArrayList<>();
        }

        public List<ChangeLiquidAmount> getAmountList() {
            return amountList;
        }

        public void setAmountList(List<ChangeLiquidAmount> amountList) {
            this.amountList = amountList;
        }

        public void add(ChangeLiquidAmount changeLiquidAmount){
            if(amountList!=null){
                amountList.add(changeLiquidAmount);
            }
        }

        public int getIntervalTime() {
            return intervalTime;
        }

        public void setIntervalTime(int intervalTime) {
            this.intervalTime = intervalTime;
        }
    }
}
